﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;

namespace T0x02泛型测试
{
    internal class Program
    {
        static void Main(string[] args)
        {
            /*  ShowInt(1);
              ShowString("你好");
              ShowDateTime(DateTime.Now);
              
              ShowObject(1);
              ShowObject("你好");
              ShowObject(DateTime.Now);
  
              Show<int>(1);
              Show<string>("你好");
              Show<DateTime>(DateTime.Now);
              */
            Monitor.Show();
        }
        
        //显示整数
        static void ShowInt(int x)
        {
            Console.WriteLine("整数为:{0}" + x);
        }

        //显示字符串
        static void ShowString(string str)
        {
            Console.WriteLine(str);
        }
        
        //显示时间
        static void ShowDateTime(DateTime dt)
        {
            Console.WriteLine("时间是:{0}"+dt);
        }
        
        //object类型，效率低下
        static void ShowObject(object obj)
        {
            Console.WriteLine(obj);
        }
        
        //泛型用法
        static void Show<T>(T t)
        {
            Console.WriteLine(t.ToString());
        }
    }
}